{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1.导入工具包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np     #矩阵操作\n",
    "import pandas as pd    #SQL数据处理\n",
    "\n",
    "from sklearn.metrics import r2_score    #评价回归预测模型的性能\n",
    "import matplotlib.pyplot as plt         #画图\n",
    "import seaborn as sns\n",
    "\n",
    "#图形出现在Notebook\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.读取数据\n",
    "# 做完特征工程后的数据，先得到文件FE_day.csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>holiday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>yr</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.355170</td>\n",
       "      <td>0.373517</td>\n",
       "      <td>0.828620</td>\n",
       "      <td>0.284606</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.379232</td>\n",
       "      <td>0.360541</td>\n",
       "      <td>0.715771</td>\n",
       "      <td>0.466215</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.171000</td>\n",
       "      <td>0.144830</td>\n",
       "      <td>0.449638</td>\n",
       "      <td>0.465740</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.175530</td>\n",
       "      <td>0.174649</td>\n",
       "      <td>0.607131</td>\n",
       "      <td>0.284297</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209120</td>\n",
       "      <td>0.197158</td>\n",
       "      <td>0.449313</td>\n",
       "      <td>0.339143</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant  season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  \\\n",
       "0        1         1         0         0         0       1       0       0   \n",
       "1        2         1         0         0         0       1       0       0   \n",
       "2        3         1         0         0         0       1       0       0   \n",
       "3        4         1         0         0         0       1       0       0   \n",
       "4        5         1         0         0         0       1       0       0   \n",
       "\n",
       "   mnth_4  mnth_5  ...  weekday_5  weekday_6      temp     atemp       hum  \\\n",
       "0       0       0  ...          0          1  0.355170  0.373517  0.828620   \n",
       "1       0       0  ...          0          0  0.379232  0.360541  0.715771   \n",
       "2       0       0  ...          0          0  0.171000  0.144830  0.449638   \n",
       "3       0       0  ...          0          0  0.175530  0.174649  0.607131   \n",
       "4       0       0  ...          0          0  0.209120  0.197158  0.449313   \n",
       "\n",
       "   windspeed  holiday  workingday  yr   cnt  \n",
       "0   0.284606        0           0   0   985  \n",
       "1   0.466215        0           0   0   801  \n",
       "2   0.465740        0           1   0  1349  \n",
       "3   0.284297        0           1   0  1562  \n",
       "4   0.339143        0           1   0  1600  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# path to where the data lies\n",
    "#dpath = './data/'\n",
    "df = pd.read_csv(\"FE_day.csv\")\n",
    "#通过观察前5行，了解数据每一列（特征）的情况\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据的基本信息\n",
    "# 样本数目、特征维数、每一个特征的类型、空值样本的数目、数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 731 entries, 0 to 730\n",
      "Data columns (total 35 columns):\n",
      "instant         731 non-null int64\n",
      "season_1        731 non-null int64\n",
      "season_2        731 non-null int64\n",
      "season_3        731 non-null int64\n",
      "season_4        731 non-null int64\n",
      "mnth_1          731 non-null int64\n",
      "mnth_2          731 non-null int64\n",
      "mnth_3          731 non-null int64\n",
      "mnth_4          731 non-null int64\n",
      "mnth_5          731 non-null int64\n",
      "mnth_6          731 non-null int64\n",
      "mnth_7          731 non-null int64\n",
      "mnth_8          731 non-null int64\n",
      "mnth_9          731 non-null int64\n",
      "mnth_10         731 non-null int64\n",
      "mnth_11         731 non-null int64\n",
      "mnth_12         731 non-null int64\n",
      "weathersit_1    731 non-null int64\n",
      "weathersit_2    731 non-null int64\n",
      "weathersit_3    731 non-null int64\n",
      "weekday_0       731 non-null int64\n",
      "weekday_1       731 non-null int64\n",
      "weekday_2       731 non-null int64\n",
      "weekday_3       731 non-null int64\n",
      "weekday_4       731 non-null int64\n",
      "weekday_5       731 non-null int64\n",
      "weekday_6       731 non-null int64\n",
      "temp            731 non-null float64\n",
      "atemp           731 non-null float64\n",
      "hum             731 non-null float64\n",
      "windspeed       731 non-null float64\n",
      "holiday         731 non-null int64\n",
      "workingday      731 non-null int64\n",
      "yr              731 non-null int64\n",
      "cnt             731 non-null int64\n",
      "dtypes: float64(4), int64(31)\n",
      "memory usage: 200.0 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 从原始数据中分离出输入特征x和输出y\n",
    "y = df[\"cnt\"]\n",
    "\n",
    "X = df.drop([\"cnt\"],axis = 1)\n",
    "\n",
    "#特征名称，用于后续显示权重系数对应的特征\n",
    "feat_names = X.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(584, 34)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将训练数据分割成训练集和测试集\n",
    "from sklearn.model_selection import train_test_split\n",
    "#随机采样208的数据构建测试样本，其余作为训练样本\n",
    "X_train,X_test,y_train,y_test = train_test_split(X,y,random_state = 33,test_size = 0.2)\n",
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>33</td>\n",
       "      <td>yr</td>\n",
       "      <td>4550.708897</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>27</td>\n",
       "      <td>temp</td>\n",
       "      <td>2654.792827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>mnth_9</td>\n",
       "      <td>1287.992360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>28</td>\n",
       "      <td>atemp</td>\n",
       "      <td>995.293778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>mnth_10</td>\n",
       "      <td>929.887649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>914.410909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>season_4</td>\n",
       "      <td>830.579518</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>mnth_12</td>\n",
       "      <td>586.296405</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>mnth_8</td>\n",
       "      <td>517.803038</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>409.589079</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>mnth_11</td>\n",
       "      <td>407.138803</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>26</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>238.417312</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>32</td>\n",
       "      <td>workingday</td>\n",
       "      <td>216.956549</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>mnth_6</td>\n",
       "      <td>189.797216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>season_2</td>\n",
       "      <td>85.141889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>25</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>77.516263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>23</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>66.464787</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>24</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>43.650546</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>mnth_5</td>\n",
       "      <td>5.009200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>instant</td>\n",
       "      <td>-6.919060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>22</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-31.943212</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>season_3</td>\n",
       "      <td>-130.807162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-191.612446</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>21</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>-202.493250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>mnth_7</td>\n",
       "      <td>-203.137582</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>31</td>\n",
       "      <td>holiday</td>\n",
       "      <td>-263.761415</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>mnth_4</td>\n",
       "      <td>-485.714239</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>mnth_3</td>\n",
       "      <td>-541.439917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>season_1</td>\n",
       "      <td>-784.914245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>30</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-1174.845790</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>mnth_2</td>\n",
       "      <td>-1207.111892</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>29</td>\n",
       "      <td>hum</td>\n",
       "      <td>-1298.592138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>-1323.999988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>mnth_1</td>\n",
       "      <td>-1486.521042</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns         coef\n",
       "33            yr  4550.708897\n",
       "27          temp  2654.792827\n",
       "13        mnth_9  1287.992360\n",
       "28         atemp   995.293778\n",
       "14       mnth_10   929.887649\n",
       "17  weathersit_1   914.410909\n",
       "4       season_4   830.579518\n",
       "16       mnth_12   586.296405\n",
       "12        mnth_8   517.803038\n",
       "18  weathersit_2   409.589079\n",
       "15       mnth_11   407.138803\n",
       "26     weekday_6   238.417312\n",
       "32    workingday   216.956549\n",
       "10        mnth_6   189.797216\n",
       "2       season_2    85.141889\n",
       "25     weekday_5    77.516263\n",
       "23     weekday_3    66.464787\n",
       "24     weekday_4    43.650546\n",
       "9         mnth_5     5.009200\n",
       "0        instant    -6.919060\n",
       "22     weekday_2   -31.943212\n",
       "3       season_3  -130.807162\n",
       "20     weekday_0  -191.612446\n",
       "21     weekday_1  -202.493250\n",
       "11        mnth_7  -203.137582\n",
       "31       holiday  -263.761415\n",
       "8         mnth_4  -485.714239\n",
       "7         mnth_3  -541.439917\n",
       "1       season_1  -784.914245\n",
       "30     windspeed -1174.845790\n",
       "6         mnth_2 -1207.111892\n",
       "29           hum -1298.592138\n",
       "19  weathersit_3 -1323.999988\n",
       "5         mnth_1 -1486.521042"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性回归\n",
    "# class sklearn.linear_model.LinearRegression(fit_intercept = True,normalize = False,copy_X = True,n_jobs = 1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "#1.使用默认配置初始化学习器实例\n",
    "lr = LinearRegression()\n",
    "\n",
    "#2.用训练数据训练模型参数\n",
    "lr.fit(X_train,y_train)\n",
    "\n",
    "#3.用训练好的模型对测试集进行预测\n",
    "y_test_pred_lr = lr.predict(X_test)\n",
    "y_train_pred_lr = lr.predict(X_train)\n",
    "\n",
    "#查看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names),\"coef\":list((lr.coef_.T))})\n",
    "fs.sort_values(by=['coef'],ascending = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is 0.8279474225980328\n",
      "The r2 score of LinearRegression on train is 0.8516480637403496\n"
     ]
    }
   ],
   "source": [
    "# 使用r2_score评价模型在测试集上的性能，并输出评估结果\n",
    "# 测试集\n",
    "print(\"The r2 score of LinearRegression on test is\",r2_score(y_test,y_test_pred_lr))\n",
    "#训练集\n",
    "print(\"The r2 score of LinearRegression on train is\",r2_score(y_train,y_train_pred_lr))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1a1b6afad0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeUAAAFsCAYAAADyj6FyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAer0lEQVR4nO3de5SddX3v8feXZEwsEUJggjHRJngCck2CAyYHxWjkUoOEnqWCh0ssUVxoW6tHK0gto9Vz9MCylQPHnhwvBMESiKWhddnCSclKZSl0ohHBgAlIJJgmQ5BLQISE7/ljP4k7k5nMnslM5jez36+19trP83su+/v8Zvb+zHOZZ0dmIkmSht4BQ12AJEmqMZQlSSqEoSxJUiEMZUmSCmEoS5JUCENZkqRCGMrSAImIByJi7lDXMZQi4g8j4rGI2BYRsxqYf2VEfGB/1CYNB4ay1ICIeDQi3tGl7f0R8f2d45l5bGau7GU9UyMiI2L0IJU61K4G/jgzx2Xmj4e6GGm4MZSlEaSAsP994IEhrkEatgxlaYDU701HxMkR0RERz0TE5oj4cjXbqur5qeoQ75yIOCAi/iIiNkTEloi4ISIOrlvvRdW0rRHxmS6v0x4RyyLixoh4Bnh/9do/iIinImJTRFwbEa+oW19GxIcjYl1EPBsRfxURr6+WeSYibqmfv8s2dltrRIyJiG3AKOAnEfFwD8ufFhEPRsTTEXEtEHXTXh8R/1pt5xMRcVNEjK+mfTIivtNlXf8rIv6mbz8lqWyGsjQ4vgJ8JTMPAl4P3FK1n1o9j68O8f4AeH/1eBtwBDAOuBYgIo4B/jdwPjAJOBiY3OW1FgDLgPHATcAO4GPAYcAcYB7w4S7LnAm8EZgN/DmwuHqN1wLHAe/rYbu6rTUzf5uZ46p5ZmTm67suGBGHAd8B/qKq7WHglPpZgP8BvAY4uqqlvZp2I3BmXUiPBs4FvtVDndKwZChLjfuHau/zqYh4ilpY9uQl4D9FxGGZuS0zf7iXec8Hvpy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ZU45IkqZ/6ek55HvBwZm6IiAXA3Kp9CbAS+NTAlSZJzeOll15i48aNvPDCC0NdigbI2LFjmTJlCi0tLQ0v09dQPo/aDekBDq++45TM3BQRE/u4LklSZePGjbzqVa9i6tSp1L5AS8NZZrJ161Y2btzItGnTGl6u4Qu9qm+oORu4tS+FRcQlEdERER2dnZ19WVSSmsYLL7zAoYceaiCPEBHBoYce2ucjH325+voPgB9l5s7vTd0cEZOqF59E7Ztr9pCZizOzLTPbWlu7/bcsSRIYyCNMf36efQnl9/G7Q9cAtwMLq+GFwPI+v7okSdqloXPKEfF7wGnAh+qavwjcEhGLgF9S+55USdIAaG/f/+sbNWoUxx9/PNu3b2fatGl861vfYvz48X1+rQ984AN8/OMf55hjjtmt/frrr6ejo4Nrr722z+sEGDduHNu2bWto3rlz53L11VfT1ta2q62jo4MbbriBa665pl+vvz80tKecmc9n5qGZ+XRd29bMnJeZ06vnJwevTEnSYHvlK1/JmjVruP/++5kwYQLXXXddv9bzta99bY9ALkFbW9ugB/KOHTv2aXnv6CVJ2sOcOXN4/PHHd41fddVVnHTSSZxwwglceeWVADz33HPMnz+fGTNmcNxxx7F06VKgtpe685bK3/zmNznyyCN561vfyt13371rfe9///tZtmzZrvFx48YBsG3bNubNm8eJJ57I8ccfz/Lle54Z3bRpE6eeeiozZ87kuOOO49/+7d8a2qaVK1dy1llnAdDe3s7FF1/M3LlzOeKII3YL6xtvvJGTTz6ZmTNn8qEPfWhX0F566aW0tbVx7LHH7uoDqN1C+nOf+xxvfvObufXWPl0LvQe/T1mStJsdO3awYsUKFi1aBMAdd9zBunXruPfee8lMzj77bFatWkVnZyevec1r+O53vwvA008/vdt6Nm3axJVXXsnq1as5+OCDedvb3sasWbP2+tpjx47ltttu46CDDuKJJ55g9uzZnH322btdNPXtb3+bM844gyuuuIIdO3bw/PPP92s7H3zwQe666y6effZZjjrqKC699FLWr1/P0qVLufvuu2lpaeHDH/4wN910ExdddBFf+MIXmDBhAjt27GDevHncd999nHDCCb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QS2wgIlVe19/J4ad6jDsLGp7ik3VDxExKiLWAFuo/UHxMD2/p3dtazX9aWqfAQPWByMulCPi/0XE/d08FgBk5hWZ+VrgJmDnfbp7umVoX9uL0FsfVPNcAWyn1g8wwvoAGuuH7hbrpm1Y90M/jMRt2hcj+mcfEeOA7wB/1uVo4h6zdtM27PshM3dk5kxqRw1PpnZqa4/ZqudB74N9ufd1kTLzHQ3O+m3gu8CV9HzL0I3A3C7tK6v2Kd3MX4Te+qC6EOMsYF51+B32ftvU7tqfoHb4anT1F2NRfQB9+l2oN+L6oR+a9Ra6myNiUmZuqg7Lbqna+/r5MGxERAu1QL4pM/++am66fgDIzKciYiW1c8o9vad39sHGiBgNHEztNMiAvWdG3J7y3kTE9LrRs4EHq+HbgYuqqwtnA09Xh23+BTg9Ig6prkA8HfiXatqzETG7Op9wEbB8/21J/0XEmcCngLMz8/m6SbcD51VXF04DplO7mK3b26lWYX4X8O5q+YUMkz7ohf3QvLfQvZ3azw92/zn26fNhfxfdX9Vn19eBtZn55bpJTdMPEdEa1X+gRMQrgXdQO7fe03u6vm/eDfxr9RnQ0+dG3w3mlW2lPaj9RXg/cB/wj8Dk/N0VeNdRO5fwU3a/Gvdiaift1wN/VNfeVq3rYeBaqrujlf6otuMxYE31+Nu6aVdU2/MQdVeTU7vq8ufVtCvq2o+ofvHWA7cCY4Z6+/rQD39I7a/b3wKbqf2x1XT9sJf+6XZbR8oD+DtgE/BS9XuwiNq5wRXAuup5QjVvnz8fhsMDeDO1Q6z31X0evLOZ+gE4Afhx1Qf3A39ZtXf7ngbGVuPrq+lH1K2r28+Nvj68zaYkSYVoqsPXkiSVzFCWJKkQhrIkSYUwlCVJKoShLElSIQxlSZIKYShLklSI/w8TY7j/E8UBPAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 在训练集上观察预测残差的分布，是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f,ax = plt.subplots(figsize = (7,5))\n",
    "f.tight_layout()\n",
    "ax.hist(y_train-y_train_pred_lr,bins = 40,label = \"Residuals Linear\",color = 'b',alpha =0.5)\n",
    "ax.set_title(\"Histogram of day\")\n",
    "ax.legend(loc = 'best')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "残差分布和高斯分布相比较，从图中可以看出在边缘出有噪声。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO2df5RcdZXgP7erK0kFgU40urFJJsHhwJLJkIYeiWZ/SJghCAI9/DDh4BhddjlnV2eBdeN2VtYEB4c4GQXdM+MMR3BRGQgkbBuMsxnWxLO7eIh07MQYIENGIEkno3GSRiUtVLrv/lHf17yqeu/Vq+73ql513885fbre9/2o+1533brf+70/RFUxDMNIg7ZmC2AYxuTFFIxhGKlhCsYwjNQwBWMYRmqYgjEMIzXamy1AGrzjHe/QBQsWNFsMw5gy7N69+xeqOqdyfFIqmAULFtDf399sMQxjyiAirwaN2xTJMIzUSFXBiMidIrJfRH4iIo+KyAwRWSgiu0TkJRHZJCLT3LHT3fZBt3+B7zpr3fgBEVmRpsyGYSRHagpGRDqB/wh0q+rvADlgFfAF4D5VPQ84CdzqTrkVOKmqvw3c545DRC505y0CrgT+UkRyacltGEZypD1FagcKItIOzASOAcuBzW7/w0CPe32d28btv1xExI0/pqpvqOrLwEHgvSnLbRiZp29gkGUbdrCwdxvLNuygb2Cw2SJVkZqCUdVB4M+BQ5QUy2vAbmBIVU+7w44Ane51J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hTJMIwGYArGMIzUMAVjGEZqmIIxDCM1TMEYhpEapmCMpiEi60XkPzdbDiM9TMEYhpEapmCMhiIin3E1SP43cL4b+3ci8pyI7BWRLS5S9UwRedmlTyAiZ4nIK9620RqYgjEahohcQimloAu4Hvg9t+tJVf09Vb0IeAG4VVV/BXwfuNodswrYoqUcHKNFMAVjNJJ/CfxPVT2lpUxxL//rd0Tk/4rIPuAWYJEb/xrwcff648DXGyqtMWFMwRiNJig35X8An1TVxZRybWYAqOozwAIR+deUKq79pGFSGolgCsZoJP8H+EMRKYjImcA1bvxM4Jjzr9xScc43gEcx66UlsWRHo6GIyGeAjwKvUqpL8jylgk+fdmP7gDNV9WPu+H9GqbzlXFUdaobMxvgxBWNkGhG5EbhOVf+o2bIY9dNe+xDDaA4i8t8plYS8qtmyGOPDLBjDMFLDnLyGYaSGKRjDMFLDFIxhGKlhCsYwjNQwBWMYRmr8f4V2RRb/LxU7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 288x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 还可以通过观察预测值与真值之间的散点图\n",
    "plt.figure(figsize = (4,3))\n",
    "plt.scatter(y_train,y_train_pred_lr)\n",
    "plt.plot([-3,3],[-3,3],\"--k\")         #数据已经标准化，3倍标准化即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('day')\n",
    "plt.ylabel('cnt')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.2正则化-岭回归（Ridge）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is 0.8289740676972926\n",
      "The r2 score of LinearRegression on train is 0.849770002972564\n"
     ]
    }
   ],
   "source": [
    "# 岭回归/L2正则\n",
    "# class sklearn.linear_model.RidgeCV(alphas = (0.1, 1.0, 10.0),fit_intercept = True,\n",
    "#                                   normalize = False,scoring = None,cv = None,gcv_mode = None,\n",
    "#                                   score_cv_values = False)\n",
    "from sklearn.linear_model import RidgeCV\n",
    "# 1.设置超参数（正则参数）范围\n",
    "alphas = [0.01,0.1,1,10,100]\n",
    "# n_alphas = 20\n",
    "#alphas = np.logspace(-5,2,n_alphas)\n",
    "# 2.生成一个RidgeCV实例\n",
    "ridge = RidgeCV(alphas = alphas,store_cv_values = True)\n",
    "\n",
    "#3.模型训练\n",
    "ridge.fit(X_train,y_train)\n",
    "\n",
    "#4.模型预测\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "#评估，使用r2_score评价模型在预测集和训练集上的性能\n",
    "# 测试集\n",
    "print(\"The r2 score of LinearRegression on test is\",r2_score(y_test,y_test_pred_ridge))\n",
    "#训练集\n",
    "print(\"The r2 score of LinearRegression on train is\",r2_score(y_train,y_train_pred_ridge))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEGCAYAAACUzrmNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAbnUlEQVR4nO3deZhV9Z3n8fcHimJHthLZFFRMxCRGumI0ZjFiMpGkg1mMZiWOGcbpLCbpmYSePNPpSU+6k860C60xD61J45O0WTSJjG0WQI0xiUbABZUIJSKUIJSAIEvY6jt/nF/hpbjFuUjdpep+Xs9Tzznnd373nO89VXU/9yz3XEUEZmZmR9Kn2gWYmVntc1iYmVkuh4WZmeVyWJiZWS6HhZmZ5Wqodg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B/yXAW47+qZrlq5sbCZodpTeT3X31ALBR0m+AN6T2n0REO/C8pHsKHjMWaCuY/lC6ZXxDmjeV7PYMhdqBH6Xx7wOFN4TrGF9KFlAA/YDrJb0eOACcVtB/E9ktV8y6ncPCrLiuvojoSF9QtJvsnk9Imgz8d+ANEbFV0r91zMtReP+dPWl4gJf/V79Adj+uM8mODPy5oP+AVINZt/NhKLPi7gMuldQ3nUd4K9kN/+4n+3KgPpLGkH2tZocVwKlpfBiwE9iW+l3UxXr6kN11FuAjaflHchywIe3ZfJzsq1I7nEZt3HHYeiHvWZgV9zOy8xGPkr3b/1JEPC/pdmA62YvySrJvJ9uWHvMfZOGxKCIelfQw2R1JVwO/62I9O4EzJC1Ny7k0p65vA7dLuoTsrrA7C+a9PdVg1u1811mzoyRpSGTfjDaKbG/jvBQkA8lewM9L5zpKWdaOiBjSTXXdB8yMiK3dsTyzQt6zMDt6d0oaDjQCfx8RzwNExG5JXyX7nuO1lSwoHSq72kFh5eI9CzMzy+UT3GZmlsthYWZmuRwWZmaWy2FhZma5HBZmZpbr/wNI8IjQl3Uu6gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 1.0\n"
     ]
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_,axis = 0)\n",
    "rmse = mse_mean**0.5\n",
    "plt.plot(np.log10(alphas),rmse.reshape(len(alphas),1))\n",
    "#为了标出最佳参数的位置\n",
    "plt.plot(np.log10(ridge.alpha_)*np.ones(3),[0.28,0.29,0.30])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('rmse')\n",
    "plt.show()\n",
    "print(\"alpha is:\",ridge.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>33</td>\n",
       "      <td>yr</td>\n",
       "      <td>4550.708897</td>\n",
       "      <td>1504.623924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>27</td>\n",
       "      <td>temp</td>\n",
       "      <td>2654.792827</td>\n",
       "      <td>1778.493414</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>mnth_9</td>\n",
       "      <td>1287.992360</td>\n",
       "      <td>678.352931</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>28</td>\n",
       "      <td>atemp</td>\n",
       "      <td>995.293778</td>\n",
       "      <td>1546.374034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>mnth_10</td>\n",
       "      <td>929.887649</td>\n",
       "      <td>84.873020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>914.410909</td>\n",
       "      <td>914.843092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>season_4</td>\n",
       "      <td>830.579518</td>\n",
       "      <td>767.205317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>mnth_12</td>\n",
       "      <td>586.296405</td>\n",
       "      <td>-824.928596</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>mnth_8</td>\n",
       "      <td>517.803038</td>\n",
       "      <td>205.686009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>409.589079</td>\n",
       "      <td>388.865215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>mnth_11</td>\n",
       "      <td>407.138803</td>\n",
       "      <td>-725.828529</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>26</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>238.417312</td>\n",
       "      <td>227.515740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>32</td>\n",
       "      <td>workingday</td>\n",
       "      <td>216.956549</td>\n",
       "      <td>212.558710</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>mnth_6</td>\n",
       "      <td>189.797216</td>\n",
       "      <td>369.663154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>season_2</td>\n",
       "      <td>85.141889</td>\n",
       "      <td>110.998614</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>25</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>77.516263</td>\n",
       "      <td>81.396550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>23</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>66.464787</td>\n",
       "      <td>59.857933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>24</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>43.650546</td>\n",
       "      <td>62.795850</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>mnth_5</td>\n",
       "      <td>5.009200</td>\n",
       "      <td>387.713628</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>instant</td>\n",
       "      <td>-6.919060</td>\n",
       "      <td>1.417157</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>22</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-31.943212</td>\n",
       "      <td>-34.140080</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>season_3</td>\n",
       "      <td>-130.807162</td>\n",
       "      <td>-91.388275</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-191.612446</td>\n",
       "      <td>-191.851510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>21</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>-202.493250</td>\n",
       "      <td>-205.574484</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>mnth_7</td>\n",
       "      <td>-203.137582</td>\n",
       "      <td>-242.548582</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>31</td>\n",
       "      <td>holiday</td>\n",
       "      <td>-263.761415</td>\n",
       "      <td>-248.222941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>mnth_4</td>\n",
       "      <td>-485.714239</td>\n",
       "      <td>106.306513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>mnth_3</td>\n",
       "      <td>-541.439917</td>\n",
       "      <td>298.550050</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>season_1</td>\n",
       "      <td>-784.914245</td>\n",
       "      <td>-786.815656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>30</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-1174.845790</td>\n",
       "      <td>-1087.773198</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>mnth_2</td>\n",
       "      <td>-1207.111892</td>\n",
       "      <td>-143.125249</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>29</td>\n",
       "      <td>hum</td>\n",
       "      <td>-1298.592138</td>\n",
       "      <td>-1142.397276</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>-1323.999988</td>\n",
       "      <td>-1303.708307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>mnth_1</td>\n",
       "      <td>-1486.521042</td>\n",
       "      <td>-194.714350</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns      coef_lr   coef_ridge\n",
       "33            yr  4550.708897  1504.623924\n",
       "27          temp  2654.792827  1778.493414\n",
       "13        mnth_9  1287.992360   678.352931\n",
       "28         atemp   995.293778  1546.374034\n",
       "14       mnth_10   929.887649    84.873020\n",
       "17  weathersit_1   914.410909   914.843092\n",
       "4       season_4   830.579518   767.205317\n",
       "16       mnth_12   586.296405  -824.928596\n",
       "12        mnth_8   517.803038   205.686009\n",
       "18  weathersit_2   409.589079   388.865215\n",
       "15       mnth_11   407.138803  -725.828529\n",
       "26     weekday_6   238.417312   227.515740\n",
       "32    workingday   216.956549   212.558710\n",
       "10        mnth_6   189.797216   369.663154\n",
       "2       season_2    85.141889   110.998614\n",
       "25     weekday_5    77.516263    81.396550\n",
       "23     weekday_3    66.464787    59.857933\n",
       "24     weekday_4    43.650546    62.795850\n",
       "9         mnth_5     5.009200   387.713628\n",
       "0        instant    -6.919060     1.417157\n",
       "22     weekday_2   -31.943212   -34.140080\n",
       "3       season_3  -130.807162   -91.388275\n",
       "20     weekday_0  -191.612446  -191.851510\n",
       "21     weekday_1  -202.493250  -205.574484\n",
       "11        mnth_7  -203.137582  -242.548582\n",
       "31       holiday  -263.761415  -248.222941\n",
       "8         mnth_4  -485.714239   106.306513\n",
       "7         mnth_3  -541.439917   298.550050\n",
       "1       season_1  -784.914245  -786.815656\n",
       "30     windspeed -1174.845790 -1087.773198\n",
       "6         mnth_2 -1207.111892  -143.125249\n",
       "29           hum -1298.592138 -1142.397276\n",
       "19  weathersit_3 -1323.999988 -1303.708307\n",
       "5         mnth_1 -1486.521042  -194.714350"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names),\"coef_lr\":list((lr.coef_.T)),\"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by = ['coef_lr'],ascending = False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 正则化的线性回归（L1正则-->Lasso）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is 0.47062572154686677\n",
      "The r2 score of LinearRegression on train is 0.4427527534180159\n"
     ]
    }
   ],
   "source": [
    "#### Lasso/L1正则化\n",
    "# class sklearn.linear_model.LassoCV(eps = 0.001,n_alphas = 100,alphas=None,fit_intercept=True,\n",
    "#                                     normalize = False,precompute='auto',max_iter=1000,\n",
    "#                                     tol=0.0001,copy_X=True,cv=None,verbose=False,n_jobs=1,\n",
    "#                                      positive=False,random_state=None,selection='cyclic')\n",
    "\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#1.设置超参数搜索范围\n",
    "# alphas = [0.01,0.1,1,10,100]\n",
    "\n",
    "#2.生成学习器实例\n",
    "#lasso = LassoCV(alphas = alphas)\n",
    "lasso = LassoCV(cv=5)\n",
    "\n",
    "#3.训练（内含cv）\n",
    "lasso.fit(X_train,y_train)\n",
    "\n",
    "#4.测试\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "#评估，使用r2_score评价模型在预测集和训练集上的性能\n",
    "# 测试集\n",
    "print(\"The r2 score of LinearRegression on test is\",r2_score(y_test,y_test_pred_lasso))\n",
    "#训练集\n",
    "print(\"The r2 score of LinearRegression on train is\",r2_score(y_train,y_train_pred_lasso))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEJCAYAAABlmAtYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAb1UlEQVR4nO3dfZQcdZ3v8fcnMwl5JoQMMeTBBExQ4GKAMeBGWVwIBi4IustCVMi6rBEOXMGHVdRzL1493Ou5ig+syJ4IOcCKQRSBiFkxIMKCRDIJIQ8EyBCQDDMkAwl5II8z871/dI00Sc9UE7q7ZqY/r3PmTPW3flX17cMhn6mqX3cpIjAzM+tOv6wbMDOzns9hYWZmqRwWZmaWymFhZmapHBZmZpbKYWFmZqnKFhaSxkt6SNIaSaslXZnUR0paJGlt8vuQpC5J10tqlLRC0gl5+5qdjF8raXa5ejYzs8JUrs9ZSBoDjImIZZKGAUuB84B/AjZFxHckXQ0cEhFflXQW8D+As4CTgB9FxEmSRgINQD0QyX5OjIjNZWnczMz2U1uuHUdEC9CSLG+TtAYYC5wLnJoMuxX4I/DVpH5b5NJrsaQRSeCcCiyKiE0AkhYBM4H53R1/1KhRMXHixNK+KTOzPmzp0qWvRkRdoXVlC4t8kiYCxwN/BkYnQUJEtEg6LBk2Flift1lTUuuq3q2JEyfS0NDwjns3M6sWkv7S1bqy3+CWNBS4C7gqIrZ2N7RALbqpFzrWHEkNkhpaW1vffrNmZlZQWcNCUn9yQXF7RPw6KW9ILi913tfYmNSbgPF5m48Dmrup7yci5kZEfUTU19UVPJMyM7MDUM7ZUAJuBtZExPfzVi0AOmc0zQbuzatfnMyKOhnYklyuuh84Q9IhycypM5KamZlV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noEODciNpdif2adfGZhdmDuSx5ENAD4dkS8AhAROyVdQ+757S9VsqHkUtn3HRRWDj6zMDOzVL7BbWZmqRwWZmaWymFhZmapHBZmZpbKYWFmZqkcFmZmlur/A9Wpa+xZ/93xAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 256.4697701374553\n"
     ]
    }
   ],
   "source": [
    "mse_mean = np.mean(lasso.mse_path_,axis = 1)\n",
    "rmse = mse_mean ** 0.5\n",
    "plt.plot(np.log10(lasso.alphas_),rmse)\n",
    "plt.plot(np.log10(ridge.alpha_)*np.ones(3),[0.3,0.4,1.0])\n",
    "plt.xlabel(\"log(alpha)\")\n",
    "plt.ylabel('rmse')\n",
    "plt.show()\n",
    "print('alpha is:',lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>coef_lasso</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>33</td>\n",
       "      <td>yr</td>\n",
       "      <td>4550.708897</td>\n",
       "      <td>1504.623924</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>27</td>\n",
       "      <td>temp</td>\n",
       "      <td>2654.792827</td>\n",
       "      <td>1778.493414</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>mnth_9</td>\n",
       "      <td>1287.992360</td>\n",
       "      <td>678.352931</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>28</td>\n",
       "      <td>atemp</td>\n",
       "      <td>995.293778</td>\n",
       "      <td>1546.374034</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>mnth_10</td>\n",
       "      <td>929.887649</td>\n",
       "      <td>84.873020</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>914.410909</td>\n",
       "      <td>914.843092</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>season_4</td>\n",
       "      <td>830.579518</td>\n",
       "      <td>767.205317</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>mnth_12</td>\n",
       "      <td>586.296405</td>\n",
       "      <td>-824.928596</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>mnth_8</td>\n",
       "      <td>517.803038</td>\n",
       "      <td>205.686009</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>409.589079</td>\n",
       "      <td>388.865215</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>mnth_11</td>\n",
       "      <td>407.138803</td>\n",
       "      <td>-725.828529</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>26</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>238.417312</td>\n",
       "      <td>227.515740</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>32</td>\n",
       "      <td>workingday</td>\n",
       "      <td>216.956549</td>\n",
       "      <td>212.558710</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>mnth_6</td>\n",
       "      <td>189.797216</td>\n",
       "      <td>369.663154</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>season_2</td>\n",
       "      <td>85.141889</td>\n",
       "      <td>110.998614</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>25</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>77.516263</td>\n",
       "      <td>81.396550</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>23</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>66.464787</td>\n",
       "      <td>59.857933</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>24</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>43.650546</td>\n",
       "      <td>62.795850</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>mnth_5</td>\n",
       "      <td>5.009200</td>\n",
       "      <td>387.713628</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>instant</td>\n",
       "      <td>-6.919060</td>\n",
       "      <td>1.417157</td>\n",
       "      <td>5.456671</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>22</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-31.943212</td>\n",
       "      <td>-34.140080</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>season_3</td>\n",
       "      <td>-130.807162</td>\n",
       "      <td>-91.388275</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-191.612446</td>\n",
       "      <td>-191.851510</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>21</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>-202.493250</td>\n",
       "      <td>-205.574484</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>mnth_7</td>\n",
       "      <td>-203.137582</td>\n",
       "      <td>-242.548582</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>31</td>\n",
       "      <td>holiday</td>\n",
       "      <td>-263.761415</td>\n",
       "      <td>-248.222941</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>mnth_4</td>\n",
       "      <td>-485.714239</td>\n",
       "      <td>106.306513</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>mnth_3</td>\n",
       "      <td>-541.439917</td>\n",
       "      <td>298.550050</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>season_1</td>\n",
       "      <td>-784.914245</td>\n",
       "      <td>-786.815656</td>\n",
       "      <td>-341.190505</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>30</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-1174.845790</td>\n",
       "      <td>-1087.773198</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>mnth_2</td>\n",
       "      <td>-1207.111892</td>\n",
       "      <td>-143.125249</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>29</td>\n",
       "      <td>hum</td>\n",
       "      <td>-1298.592138</td>\n",
       "      <td>-1142.397276</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>-1323.999988</td>\n",
       "      <td>-1303.708307</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>mnth_1</td>\n",
       "      <td>-1486.521042</td>\n",
       "      <td>-194.714350</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns      coef_lr   coef_ridge  coef_lasso\n",
       "33            yr  4550.708897  1504.623924    0.000000\n",
       "27          temp  2654.792827  1778.493414    0.000000\n",
       "13        mnth_9  1287.992360   678.352931    0.000000\n",
       "28         atemp   995.293778  1546.374034    0.000000\n",
       "14       mnth_10   929.887649    84.873020    0.000000\n",
       "17  weathersit_1   914.410909   914.843092    0.000000\n",
       "4       season_4   830.579518   767.205317   -0.000000\n",
       "16       mnth_12   586.296405  -824.928596   -0.000000\n",
       "12        mnth_8   517.803038   205.686009    0.000000\n",
       "18  weathersit_2   409.589079   388.865215   -0.000000\n",
       "15       mnth_11   407.138803  -725.828529   -0.000000\n",
       "26     weekday_6   238.417312   227.515740   -0.000000\n",
       "32    workingday   216.956549   212.558710    0.000000\n",
       "10        mnth_6   189.797216   369.663154    0.000000\n",
       "2       season_2    85.141889   110.998614    0.000000\n",
       "25     weekday_5    77.516263    81.396550    0.000000\n",
       "23     weekday_3    66.464787    59.857933    0.000000\n",
       "24     weekday_4    43.650546    62.795850    0.000000\n",
       "9         mnth_5     5.009200   387.713628    0.000000\n",
       "0        instant    -6.919060     1.417157    5.456671\n",
       "22     weekday_2   -31.943212   -34.140080    0.000000\n",
       "3       season_3  -130.807162   -91.388275    0.000000\n",
       "20     weekday_0  -191.612446  -191.851510   -0.000000\n",
       "21     weekday_1  -202.493250  -205.574484   -0.000000\n",
       "11        mnth_7  -203.137582  -242.548582    0.000000\n",
       "31       holiday  -263.761415  -248.222941   -0.000000\n",
       "8         mnth_4  -485.714239   106.306513    0.000000\n",
       "7         mnth_3  -541.439917   298.550050    0.000000\n",
       "1       season_1  -784.914245  -786.815656 -341.190505\n",
       "30     windspeed -1174.845790 -1087.773198   -0.000000\n",
       "6         mnth_2 -1207.111892  -143.125249   -0.000000\n",
       "29           hum -1298.592138 -1142.397276   -0.000000\n",
       "19  weathersit_3 -1323.999988 -1303.708307   -0.000000\n",
       "5         mnth_1 -1486.521042  -194.714350   -0.000000"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T)), \"coef_lasso\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
